#include "input.h" 

#define true 1
#define false 0

/*REDIRECTION means command has redirection,PIPE means has pipe*/
 typedef enum Type {REDIRECTION=1,PIPE} subType;
/*IN means standin redirection,OUT means standout redirection*/
 typedef enum redirectType {INANDOUT=1,IN,OUT} redirectFlag;


/*not used yet*/
#define READ 0
#define WRITE 1



/*define common errors */
#define ERR_CREATE_PIPE "Fail to creat pipe"
#define ERR_CREATE_PROCESS "Fail to creat process"
#define ERR_CREATE_FILE "Fail to operate file"
#define ERR_EXEC "Cannot execute the command"


char** cmd_argvs(Cmdline* cmd);
/*function  runs the command and wait until the command finish*/
int cmd_run(Cmdline* cmd);
/*function processes the command run background */
int cmd_background(Cmdline* cmd);
/*if command is redirct or pipe or other situations,return subtype */
subType cmd_subType(Cmdline* cmd);
/*find out what kind of redirection the command is */
redirectFlag cmd_redirectionType(Cmdline* cmd);
/*function processes the command with io redirection */
int cmd_redirection(Cmdline* cmd,redirectFlag flag);
/*function processes the command with pipe,not implement */
int cmd_pipe(Cmdline* cmd[]);
